//
// Created by SN on 2020/1/11.
//

#include <stdio.h>
#include <stdlib.h> //rand
#include <cstring>  //strlen
#include <sys/time.h>

void test1()
{
    char arr[5];
    printf("%d\n", sizeof(arr)); //5

    char arr1[5] = {'h', 'e', 'l', 'l', 'o'};
    printf("%s\n", arr1); //hello

    char arr2[6] = "hello";
    printf("%s\n", arr2); //hello

    char arr3[] = "hello";
    printf("%s\n", arr3); //hello
    printf("%d\n", sizeof(arr3)); //6
}


//获取带空格的字符串
void test2()
{
    char buf[8] = "";
    fgets(buf, sizeof(buf), stdin);
    printf("%s\n", buf);
}


//字符串长度
void test3()
{
    char buf[] = "hello world";
    printf("%d\n", sizeof(buf)); //12
    printf("%d\n", strlen(buf)); //11
}

//库函数
void test4()
{
    srand(time(NULL));

    int ret = 0;
    for (size_t i=0; i<10; i++){
        ret = rand();
        printf("%d\n", ret);
    }


}


/**
 */
int main() {

    test4();

    return 0;
}